//
//  HNSH__AccountCell.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/2/28.
//

#import "HNSH_AccountCell.h"

@interface HNSH_AccountCell ()

/* titleLabel */
@property (nonatomic, strong) UILabel *titleLabel;
/* desLabel */
@property (nonatomic, strong) UILabel *desLabel;
/* showImgV */
@property (nonatomic, strong) UIImageView *showImgV;
/* lineView */
@property (nonatomic, strong) UIView *lineView;

@end

@implementation HNSH_AccountCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        [self configView];
    }
    return self;
}

- (void)setDict:(NSDictionary *)dict {
    _dict = dict;
    self.titleLabel.text = dict[@"title"];
    self.desLabel.text = dict[@"des"];
}

- (void)configView {
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.desLabel];
    [self.contentView addSubview:self.showImgV];
    [self.contentView addSubview:self.lineView];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(22);
    }];
    [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-36);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(22);
    }];
    [self.showImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.width.mas_equalTo(16);
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(38);
        make.right.mas_equalTo(-38);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark lazy
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.text = @"";
        _titleLabel.textColor = [UIColor appGray666LabelColor];
        _titleLabel.font = [UIFont systemFontOfSize:14];
    }
    return _titleLabel;
}

- (UILabel *)desLabel {
    if (!_desLabel) {
        _desLabel = [[UILabel alloc]init];
        _desLabel.text = @"";
        _desLabel.textColor = [UIColor appGray666LabelColor];
        _desLabel.font = [UIFont systemFontOfSize:14];
    }
    return _desLabel;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor colorWithHexString:@"#F2F3F6"];
    }
    return _lineView;
}

- (UIImageView *)showImgV {
    if (!_showImgV) {
        _showImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"base_nav_show_right"]];
    }
    return _showImgV;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
